package com.mayflygeek.mayflyask.common;

import java.util.Date;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.mayflygeek.mayflyask.util.DateUtils;
/**
 * @author 蝈蝈 
 * @email guodefu909@126.com
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * 重置密码邮件信息类
 */
@Component
public class MailResetPasswordInfo {

	@Value(value="${mail.resetPassword.template}")
	private String resetPasswordTemplate;
	
	@Value(value="${mail.resetPassword.subject}")
	private String resetPasswordSubject;
	
	@Value(value="${mail.info.logo}")
	private String logo;
	
	@Value(value="${mail.info.intro}")
	private String intro;
	
	@Value(value="${mail.info.contactEmail}")
	private String contactEmail;
	
	public String genResetPasswordContent(String userEmail,String resetPasswordUrl) {
		String sendDate = DateUtils.getDateString(new Date());
		return resetPasswordTemplate.replace("@logo", logo)
				.replace("@intro", intro)
				.replace("@userEmail", userEmail)
				.replace("@resetPasswordUrl", resetPasswordUrl)
				.replace("@sendDate", sendDate)
				.replace("@contactEmail", contactEmail);
	}

	public String getResetPasswordSubject() {
		return resetPasswordSubject;
	}
	
}
